#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<cstdio>

using namespace std;

int main()
{
	int a1, b1, a2, b2;
	double c1, c2;
	cin >> a1 >> b1 >> c1;
	cin >> a2 >> b2 >> c2;
	printf("VALOR A PAGAR: R$ %.2lf", b1 * c1 + b2 * c2);
	return 0;
}